package com.ge.myoned.controller;

import com.ge.myoned.service.TestThreadService;
import com.ge.mytestparent.dto.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author geqingxiang
 * @PackageName myProject
 * @Package com.example.myproject.controller
 * @Date 2023/4/18 13:46
 * @Version 1.0
 */
@Tag(name = "自测接口", description = "描述")
@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    private TestThreadService testThreadService;

    @Operation(summary = "测试")
    @GetMapping("/test")
    public Result<?> get(@Parameter(name = "id", description = "数据ID") Long id) {
        testThreadService.testOne();
        return Result.success("成功");
    }

    @Operation(summary = "线程测试")
    @GetMapping("/001")
    public Result<?> test001() {
        testThreadService.testOne();
        return Result.success();
    }

    @Operation(summary = "线程加锁测试")
    @GetMapping("/002")
    public Result<?> test002() {
        testThreadService.testTwo();
        return Result.success();
    }
}
